#!/usr/bin/perl

while (my $f = shift @ARGV) {
    $w=0;
    open(F,$f) || die $f;
    my $n = $f;
    $n =~ s/\.wiki//;
    
    open(OF,">foo");
    while(<F>) {
        print OF $_;
        next if $w;
        if (/^\s/) {
            print OF "= IMPORTANT NOTICE =\n\n";
            print OF "The RO project has moved to the [https://github.com/oborel \@oborel] on github, see [https://github.com/oborel/obo-relations oborel/obo-relations]\n\n";
            print OF "This wiki page has moved here: [https://github.com/oborel/obo-relations/wiki/$n $n] on github\n\n";
            print OF "= The following documentation may be out of date: =\n\n";
            $w=1;
        }
    }
    close(F);
    close(OF);
    print `mv $f $f.old`;
    print `mv foo $f`;
}
